package com.gao.b_work_queues;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author gao
 * @time 2022/07/05 10:02:48
 */
//@Component
public class Consumer {

    @RabbitListener(queuesToDeclare = @Queue("work_queue"))
    public void receive(String msg) {
        System.out.println("A: " + msg);
    }

    @RabbitListener(queuesToDeclare = @Queue("work_queue"))
    public void receive2(String msg) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("B: " + msg);
    }

}
